package wwy.Dao;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import wwy.Entity.Bookshelf;

public interface BookshelfDao extends LogicDao<Bookshelf, Long>{

    @Query("SELECT b.progress FROM Bookshelf b JOIN b.books book WHERE book.id = :bookId")
    Double findProgressByBookId(@Param("bookId") Long bookId);

    @Query("SELECT b.id FROM Bookshelf b JOIN b.books book WHERE book.id = :bookId")
    Long findBookshelfIdByBookId(@Param("bookId") Long bookId);

}
